package com.erp.auto.controller;

import com.erp.auto.domain.bo.ErpAutoPriceRiseProductProjectBo;
import com.erp.auto.service.ErpAutoPriceRiseProductProjectService;
import com.github.pagehelper.PageHelper;
import com.ruoyi.common.core.domain.R;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.*;


/**
 * 自动化店铺配置
 *
 * @author WXX
 * @date 2023-12-27 19:22:13
 */
@RestController
@AllArgsConstructor
@RequestMapping("/priceRiseProduct/priceRiseProductProject" )
public class ErpAutoPriceRiseProductProjectController {

    private final ErpAutoPriceRiseProductProjectService erpAutoPriceRiseProductProjectService;

    @PostMapping("/addProject")
    public R<Object> addProject(@RequestBody ErpAutoPriceRiseProductProjectBo projectBo) {
        return erpAutoPriceRiseProductProjectService.addProject(projectBo);
    }

    @GetMapping("/getProjectTaskList")
    public R<Object> getProjectTaskList(@RequestParam(defaultValue = "1") Integer pageNum,
                                                 @RequestParam(defaultValue = "10") Integer pageSize,
                                                 String projectId,
                                                 String status){
        PageHelper.startPage(pageNum, pageSize);
        return R.ok(erpAutoPriceRiseProductProjectService.getProjectTaskList( projectId, status));
    }

    /**
     * 根据id查看详情
     */
    @GetMapping("/queryProjectById")
    public R<Object> queryProjectById(String id) {
        return erpAutoPriceRiseProductProjectService.queryProjectById(id);
    }

    /**
     * 编辑计划
     */
    @PostMapping("/editProject")
    public R<Object> editProject(@RequestBody ErpAutoPriceRiseProductProjectBo project) {
        return erpAutoPriceRiseProductProjectService.editProject(project);
    }
    /**
     * 状态变更
     */
    @GetMapping("/editProjectStatus")
    public R<Object> editProjectStatus(String id,Integer status) {
        return erpAutoPriceRiseProductProjectService.editProjectStatus(id,status);
    }

    @GetMapping("/runJobTestOne")
    public R<Object> runJobTestOne(Long id) {
        return erpAutoPriceRiseProductProjectService.runJobTest(id);
    }

    @GetMapping("/runJobTestTwo")
    public R<Object> runJobTestTwo(Long id) {
        return erpAutoPriceRiseProductProjectService.runJobTestTwo(id);
    }
}
